import request from "../utils/request"
//登陆接口类型
export interface UserParams {
    stuNo: string
    passWord: string
}
//注册接口类型
export interface RegParams {
    userName: string
    stuNo: string
    passWord: string
}
// 个人信息接口类型
export interface userInfo {
    id:string
   userName : string
   stuNo : string
   password:string  
}
// 修改个人信息接口类型
export interface editInfo {
   id:string
   userName : string
   stuNo : string
   email:string  
   phone:string
   birth:string
   deptId:string
   gender:string
}
// 考试题目接口类型
export interface examInfo {
    id:string
    name : string
    stuNo : string
    email:string  
    phone:string
    birth:string
    deptId:string
    gender:string
 }
// 公告
export interface NoticeParams {
    noticeName: string
    noticeContent: string
}
//登录
export function loginUrl(params: UserParams) {
    return request({
        url: '/platform-authbiz/api/tuser/login',
        method: 'POST',
        data: params,
    })
}
// 个人信息获取1
export function getSelfMsg1() {
    return request({
        url: '/platform-authbiz/api/tuser/info',
        method: 'POST',
        data:"" ,
    })
}
//注册
export function regUrl(params: RegParams) {    
    return request({
        url: '/platform-authbiz/api/tuser/register',
        method: 'POST',
        data: params,
    })
}
// 获取个人信息 
export function getSelfMsg() {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-authbiz/api/tuser/selectById',
        method: 'POST',
        data: {
            userName: localStorage.getItem('userName'),
            stuNo: localStorage.getItem('stuNo')
        },
    })
}
// 修改个人信息请求
export function EditInfo(params:editInfo) {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-authbiz/api/tuser/update',
        method: 'POST',
        data: params
    })
}
// 修改密码请求
export function EditMi(userid: string, password: string, oldpassword: string) {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-authbiz/api/tuser/updatePassWord',
        method: 'POST',
        data: {
            userid,
            password,
            oldpassword
        }
    })
}
// 课程列表请求
export function getCourse(data:any) {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-serverbiz/api/curriculum/showList',
        method: 'POST',
        data
    })
}
// 课程详情
export function getCourseDetail(courseId: string | string[]){
    return request({
        url: '/platform-serverbiz/api/curriculum/selectById',
        method: 'POST',
        data: {
            id:courseId
      },
    })
}
// 章节
export function getSection(courseId: string | string[]){
    return request({
      url: "/platform-serverbiz/api/chapter/selectById",
      method: "POST",
      data: {
        id: courseId,
      },
    });
}
// 通知列表请求
export function getNotice(data:any) {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-serverbiz/api/notice/showList',
        method: 'POST',
        data
    })
}
// 通知详情
export function getNoticeDetail(noticeId: string | string[]){
    return request({
        url: '/platform-serverbiz/api/notice/selectById',
        method: 'POST',
        data: {
            id:noticeId
      },
    })
}
// 课后作业列表请求
export function getHousework() {
    return request({
        url: '/platform-authbiz/api/tuser/Housework',
        method: 'POST'
    })
}
// 考试列表请求
export function getExam(curriculumId: string | string[]) {
    return request({
        headers: {
            token: localStorage.getItem('tokey'),
        },
        url: '/platform-serverbiz/api/paper/showList',
        method: 'POST',
        data:{
            curriculumId:curriculumId
        }
    })
}
// 考试
export function Exam(examId: string | string[]){
    return request({
        url: '/platform-serverbiz/api/paper/selectById',
        method: 'POST',
        data: {
            id:examId
      },
    })
}